home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 751-760 / 758 / nochange / nochange.c < prev    next >
C/C++ Source or Header  |  1995-03-18  |  7KB  |  326 lines

  1. /* NoChange.c Written by Kamran Karimi on an A500 running OS1.3
  2. compiled with Aztec C 3.6 */
  3.  
  4. #include <exec/types.h>
  5. #include <intuition/intuition.h>
  6.  
  7. struct TextAttr BoldMess =
  8.  { (STRPTR)"topaz.font",TOPAZ_SIXTY,FSF_BOLD|FSF_ITALIC,FPF_ROMFONT };
  9.  
  10. struct TextAttr Message =
  11.  { (STRPTR)"topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPF_ROMFONT };
  12.  
  13. SHORT GadPairs[] =
  14.  { 7,11,7,3,135,3 };
  15.  
  16. struct Border GadBord =
  17.  { 2,1,1,0,JAM1,3,GadPairs,NULL };
  18.  
  19. struct IntuiText EndText =
  20.  { 1,2,JAM2,10,5,&Message,(UBYTE *)"  Quit Program  ",NULL };
  21.  
  22. struct Gadget EndGad =
  23.  { NULL,223,35,140,10,GADGHCOMP,GADGIMMEDIATE,BOOLGADGET,
  24. (APTR)&GadBord,NULL,&EndText,NULL,NULL,3,NULL };
  25.  
  26. struct IntuiText AcceptText =
  27.  { 1,2,JAM2,10,5,&Message,(UBYTE *)" Accept Changes ",NULL };
  28.  
  29. struct Gadget AcceptGad =
  30.  { &EndGad,393,52,140,10,GADGHCOMP,GADGIMMEDIATE,BOOLGADGET,
  31. (APTR)&GadBord,NULL,&AcceptText,NULL,NULL,2,NULL };
  32.  
  33. struct IntuiText RestoreText =
  34.  { 1,2,JAM2,10,5,&Message,(UBYTE *)" Restore Vectors",NULL };
  35.  
  36. struct Gadget RestoreGad =
  37.  { &AcceptGad,33,52,140,10,GADGHCOMP,GADGIMMEDIATE,BOOLGADGET,
  38. (APTR)&GadBord,NULL,&RestoreText,NULL,NULL,1,NULL };
  39.  
  40. struct IntuiText DoNothingText =
  41.  { 1,2,JAM2,10,5,&Message,(UBYTE *)"   Do Nothing   ",NULL };
  42.  
  43. struct Gadget DoNothingGad =
  44.  { &RestoreGad,223,52,140,10,GADGHCOMP,GADGIMMEDIATE,BOOLGADGET,
  45. (APTR)&GadBord,NULL,&DoNothingText,NULL,NULL,4,NULL };
  46.  
  47. struct IntuiText Text1 =
  48.  { 3,0,JAM2,250,2,&BoldMess,(UBYTE *)"DANGER!",NULL };
  49.  
  50. struct IntuiText Text2 =
  51.  { 1,0,JAM2,277,12,&BoldMess,(UBYTE *)" Have Been Changed!",&Text1 };
  52.  
  53. struct IntuiText DBAlert =
  54.  { 3,0,JAM2,33,12,&BoldMess,(UBYTE *)"DebugEntry/Data Vectors ",NULL };
  55.  
  56. struct IntuiText KMx =
  57.  { 3,0,JAM2,33,12,&BoldMess,(UBYTE *)"KickMem/TagPtr Vectors  ",NULL };
  58.  
  59. struct IntuiText DS =
  60.  { 3,0,JAM2,33,12,&BoldMess,(UBYTE *)"DoIO/SendIO Vectors     ",NULL };
  61.  
  62. struct IntuiText CCC =
  63.  { 3,0,JAM2,33,12,&BoldMess,(UBYTE *)"Cold/CoolCapture Vectors ",NULL };
  64.  
  65. struct IntuiText Intro1 =
  66.  { 2,0,JAM2,240,3,&BoldMess,(UBYTE *)"NO CHANGE",NULL };
  67.  
  68. struct IntuiText Intro2 =
  69.  { 1,0,JAM2,55,15,&Message,(UBYTE *)
  70.    "  Informs you of changes made to some ExecBase vectors",&Intro1 };
  71.  
  72. struct IntuiText Intro3 =
  73.  { 3,0,JAM2,220,30,&Message,(UBYTE *)" By Kamran Karimi",&Intro2 };
  74.  
  75.  
  76. struct NewWindow MyWindow =
  77.  { 30,20,575,50,2,3,NULL,WINDOWDEPTH|WINDOWDRAG,NULL,
  78. NULL,(UBYTE *)"NO CHANGE",NULL,NULL,0,0,0,0,WBENCHSCREEN };
  79.  
  80. struct IntuitionBase *IntuitionBase;
  81. struct Window *window;
  82. struct IntuiMessage *Intuimessage;
  83. USHORT GadNR;
  84. struct RastPort *windowRP;
  85.  
  86.  ULONG ColdC,CoolC,DoIO1,SendIO1,ColdC2,CoolC2,DoIO2,SendIO2;
  87.  ULONG DBData,DBData2,DBEntry,DBEntry2,AlertData,AlertData2;
  88.  ULONG KMPtr,KMPtr2,KTPtr,KTPtr2,KCPtr,KCPtr2;
  89.  struct IntuiText *Warn;
  90.  UWORD CheckSum,CheckSum2;
  91.  
  92. struct Library *OpenLibrary();
  93. struct Window  *OpenWindow();
  94. void CloseWindow(),CloseLibrary();
  95. void PrintIText(),Forbid(),Permit(),Delay();
  96.  
  97. main()
  98. {
  99.  
  100.  void Changed(),Accept(),Close_All(),Restore();
  101.  ULONG Result;
  102.  
  103.   if (!(IntuitionBase = (struct IntuitionBase *)
  104.                                     OpenLibrary("intuition.library",0L)))
  105.   {
  106.    Close_All();
  107.    exit(0);
  108.   }
  109.   if (!(window = OpenWindow(&MyWindow)))
  110.   {
  111.    Close_All();
  112.    exit(10);
  113.   }
  114.   windowRP = window->RPort;
  115.   PrintIText(windowRP,&Intro3,0L,10L);
  116.   Delay(120L);
  117.   CloseWindow(window);
  118.   MyWindow.FirstGadget = &DoNothingGad;
  119.   MyWindow.IDCMPFlags = GADGETDOWN;
  120.   MyWindow.Height = 80;
  121.   Forbid();
  122. #asm
  123.   move.l a6,-(a7)
  124.   move.l 4,a6
  125.   move.l 42(a6),_ColdC
  126.   move.l 46(a6),_CoolC
  127.   move.l 66(a6),_DBEntry
  128.   move.l 70(a6),_DBData
  129.   move.l 74(a6),_AlertData
  130.   move.w 82(a6),_CheckSum
  131.   move.l 546(a6),_KMPtr
  132.   move.l 550(a6),_KTPtr
  133.   move.l 554(a6),_KCPtr
  134.   move.l -454(a6),_DoIO1
  135.   move.l -460(a6),_SendIO1
  136.   move.l (a7)+,a6
  137. #endasm
  138.   Permit();
  139.  
  140.   while(TRUE)
  141.   {
  142.    Delay(1500L);
  143.    Forbid();
  144. #asm
  145.    move.l a6,-(a7)
  146.    move.l 4,a6
  147.    move.l 42(a6),_ColdC2
  148.    move.l 46(a6),_CoolC2
  149.    move.l 66(a6),_DBEntry2
  150.    move.l 70(a6),_DBData2
  151.    move.l 74(a6),_AlertData2
  152.    move.w 82(a6),_CheckSum2
  153.    move.l 546(a6),_KMPtr2
  154.    move.l 550(a6),_KTPtr2
  155.    move.l 554(a6),_KCPtr2
  156.    move.l -454(a6),_DoIO2
  157.    move.l -460(a6),_SendIO2
  158.    move.l (a7)+,a6
  159. #endasm
  160.    Permit();
  161.  
  162.    Warn = &CCC;
  163.    if((CheckSum - CheckSum2)||(ColdC - ColdC2)||(CoolC - CoolC2))
  164.    Changed(1);
  165.  
  166.    Warn = &DBAlert;
  167.    if((DBEntry - DBEntry2)||(DBData - DBData2)||(AlertData - AlertData2))
  168.    Changed(2);
  169.  
  170.    Warn = &KMx;
  171.    if((KMPtr - KMPtr2)||(KTPtr - KTPtr2)||(KCPtr - KCPtr2))
  172.    Changed(3);
  173.  
  174.    Warn = &DS;
  175.    if((DoIO1 - DoIO2)||(SendIO1 - SendIO2))
  176.    Changed(4);
  177.   }
  178. }
  179.  
  180.  
  181. void Changed(i)
  182. short i;
  183.  {
  184.  short j;
  185.  
  186.   if(!(window = OpenWindow(&MyWindow)))
  187.   {
  188.    Close_All();
  189.    exit(10);
  190.   }
  191.   j = i;
  192.   windowRP = window->RPort;
  193.   PrintIText(windowRP,&Text2,0L,10L);
  194.   PrintIText(windowRP,Warn,2L,10L);
  195. #asm
  196.   movem.l d0/d1/a0/a1/a6,-(a7)
  197.   move.l  4,a6
  198.   move.l  _window,a0
  199.   move.l  86(a0),a0
  200.   jsr     -384(a6)
  201.   move.l  _window,a0
  202.   move.l  86(a0),a0
  203.   jsr     -372(a6)
  204.   move.l  d0,_Intuimessage
  205.   move.l  d0,a0
  206.   move.l  $1c(a0),a0
  207.   move.w  $26(a0),_GadNR
  208.   move.l  _Intuimessage,a1
  209.   jsr     -378(a6)
  210.   movem.l (a7)+,d0/d1/a0/a1/a6
  211. #endasm
  212.   switch(GadNR)
  213.   {
  214.   case 1:
  215.       Restore(j);
  216.       break;
  217.   case 2:
  218.       Accept(j);
  219.       break;
  220.   case 3:
  221.       Close_All();
  222.       exit(0);
  223.   case 4:
  224.       break;
  225.    }
  226.  CloseWindow(window);
  227.   return;
  228.  }
  229.  
  230. void Accept(i)
  231. short i;
  232. {
  233. switch(i)
  234.  {
  235.   case 1:
  236.    CheckSum = CheckSum2;
  237.    ColdC = ColdC2;
  238.    CoolC = CoolC2;
  239.    break;
  240.  
  241.   case 2:
  242.    DBEntry = DBEntry2;
  243.    DBData = DBData2;
  244.    AlertData = AlertData2;
  245.    break;
  246.  
  247.   case 3:
  248.    KMPtr = KMPtr2;
  249.    KTPtr = KTPtr2;
  250.    KCPtr = KCPtr2;
  251.    break;
  252.  
  253.   case 4:
  254.    DoIO1 = DoIO2;
  255.    SendIO1 = SendIO2;
  256.    break;
  257.  }
  258.  return;
  259. }
  260.  
  261. void Restore(i)
  262. short i;
  263. {
  264.  switch(i)
  265.  {
  266.   case 1:
  267.    Forbid();
  268. #asm
  269.    move.l a6,-(a7)
  270.    move.l 4,a6
  271.    move.w _CheckSum,82(a6)
  272.    move.l _ColdC,42(a6)
  273.    move.l _CoolC,46(a6)
  274.    move.l (a7)+,a6
  275. #endasm
  276.    Permit();
  277.    break;
  278.  
  279.   case 2:
  280.    Forbid();
  281. #asm
  282.    move.l a6,-(a7)
  283.    move.l 4,a6
  284.    move.l _DBEntry,66(a6)
  285.    move.l _DBData,70(a6)
  286.    move.l _AlertData,74(a6)
  287.    move.l (a7)+,a6
  288. #endasm
  289.    Permit();
  290.    break;
  291.  
  292.   case 3:
  293.    Forbid();
  294. #asm
  295.    move.l a6,-(a7)
  296.    move.l 4,a6
  297.    move.l _KMPtr,546(a6)
  298.    move.l _KTPtr,550(a6)
  299.    move.l _KCPtr,554(a6)
  300.    move.l (a7)+,a6
  301. #endasm
  302.    Permit();
  303.    break;
  304.  
  305.   case 4:
  306.   Forbid();
  307. #asm
  308.    move.l a6,-(a7)
  309.    move.l 4,a6
  310.    move.l _DoIO1,-454(a6)
  311.    move.l _SendIO1,-460(a6)
  312.    move.l (a7)+,a6
  313. #endasm
  314.    Permit();
  315.    break;
  316.  }
  317.  return;
  318. }
  319.  
  320. void Close_All()
  321. {
  322.  if(window) CloseWindow(window);
  323.  if(IntuitionBase) CloseLibrary(IntuitionBase);
  324.  return;
  325. }
  326.